package test.elven.d.rabbitmq;

import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.TimeoutException;

import org.junit.Test;

import elven.d.rabbitmq.server.util.Producer;
import elven.d.rabbitmq.server.util.QueueConsumer;

public class RabbitMQBasicDemo {

	private static final String queueName = "queue";
	
	public static void testPublishMessage(){
		try {
			for(int i = 0; i< 1000; i++){
				Producer producer = new Producer(queueName);
				producer.sendMessage("send Message Number "+i);
			}
		} catch (Exception  e) {
			e.printStackTrace();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			QueueConsumer consumer = new QueueConsumer(queueName);
			Thread thread = new Thread(consumer);
			thread.start();
			//testPublishMessage();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
